UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AL0OjeKHgSUM5TjqRrMIU0FYdwn65n1UsVa0GcBaEGI=' 
WHERE 
  key_id = '7b06ac4990a757244295350036588c186e2ab058ddeed01947d43f15d581112e' 
  AND (
    token = 'AL0OjeKHgSUM5TjqRrMIU0FYdwn65n1UsVa0GcBaEGI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033