UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W6a7AUKUrdNaOM3A0tf5GCTV0WlPkQAQNRMNnYowcxU=' 
WHERE 
  key_id = 'b600c083111ab562ee972b0650e0a237a7fed7983d71db1db66de4a9d497eee4' 
  AND (
    token = 'W6a7AUKUrdNaOM3A0tf5GCTV0WlPkQAQNRMNnYowcxU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036