UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5um4ilSPr23nXKCj6h/t8AkRJVP98kHuw6+7oGoye6w=' 
WHERE 
  key_id = '2ec8a3702450bc6a07469818263f5026f27d61fff3d9498da996f72a8c2b6d5a' 
  AND (
    token = '5um4ilSPr23nXKCj6h/t8AkRJVP98kHuw6+7oGoye6w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043