UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JRAF+QjwLxnc0YXA0s3AEc/9f1o6sbmyigROXbfPXwo=' 
WHERE 
  key_id = '2ae1ab102e2d12bea2e656f43080ce547f571270215c25ecf401a05439d19c7b' 
  AND (
    token = 'JRAF+QjwLxnc0YXA0s3AEc/9f1o6sbmyigROXbfPXwo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026