UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j8sqamYhi3btAoV8jzU6SfZqXv97HL3J5HqhfximN98=' 
WHERE 
  key_id = '7daca7cd5e2b75ec909a9fd1e015571399ea1eac9b28f630af5eda1a9bf4b127' 
  AND (
    token = 'j8sqamYhi3btAoV8jzU6SfZqXv97HL3J5HqhfximN98=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032