UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8E2KtDy9J42DAGa4paj/QGVX0uzWNItefvoJNwDeRP8=' 
WHERE 
  key_id = 'fdc9fa981cf7e5af753a426176f5e72988f655386ec5f367d102957d4cb4eb83' 
  AND (
    token = '8E2KtDy9J42DAGa4paj/QGVX0uzWNItefvoJNwDeRP8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040