UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VU2ZlZOpI2y3ISaZyA1JrHqWGIhnaOnwaiVmhZMEQxQ=' 
WHERE 
  key_id = '90b3a458ce952f9419b58c6269790b31de0cb66d437007e9681e7840c3fa3b1b' 
  AND (
    token = 'VU2ZlZOpI2y3ISaZyA1JrHqWGIhnaOnwaiVmhZMEQxQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017