UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5oynNjF6oXjKX8wRKR7x5oDGmjAq0md1slUQSV8oZsw=' 
WHERE 
  key_id = 'f74a24fc77856fb101f4c9e3747785d9bd1ffa993634123152448cfe2939918f' 
  AND (
    token = '5oynNjF6oXjKX8wRKR7x5oDGmjAq0md1slUQSV8oZsw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027