UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yDttPzqu4fCXHhmKQNreub1UTF+CRsmWwxAVQz4nRSY=' 
WHERE 
  key_id = '6db88c446c388b10b9c3aa9022c22cbbad9ad3d823932eec3cbb316660814810' 
  AND (
    token = 'yDttPzqu4fCXHhmKQNreub1UTF+CRsmWwxAVQz4nRSY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021