UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'thFSHFoIBPSyqriIGFxVQH9AAsIs6Ku7Zd2jq3GutzE=' 
WHERE 
  key_id = 'af3dddd88a428726953eac38267ace8135d8387945379fec2d588ce25a49e3b5' 
  AND (
    token = 'thFSHFoIBPSyqriIGFxVQH9AAsIs6Ku7Zd2jq3GutzE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045