UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nEkrLzPY0Y0C6NGHKIKv22qUUU2tUrEJv4+yGJUwfOY=' 
WHERE 
  key_id = '4ab9d9874ddd017b21db8000faf685b30526cbb6578e771ceffae5e2cc80c45d' 
  AND (
    token = 'nEkrLzPY0Y0C6NGHKIKv22qUUU2tUrEJv4+yGJUwfOY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038