UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iOk1sA9pVWdUmtqYfvxvyS0ikYu6SGflOcxGamOnVhI=' 
WHERE 
  key_id = '0e80ba21823426e48cee48f5b17f007253f263cd0005534c90a7a114bbe4f5c5' 
  AND (
    token = 'iOk1sA9pVWdUmtqYfvxvyS0ikYu6SGflOcxGamOnVhI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032