UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PrNcU4NuegrIbSd7axUD0grBPbAW1T6I+k4BulScdfo=' 
WHERE 
  key_id = '3e1dc2942f05b3c4bad521ed9396bba9ad9b1955c05dd9f57360495914278603' 
  AND (
    token = 'PrNcU4NuegrIbSd7axUD0grBPbAW1T6I+k4BulScdfo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021