UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tD81rRFrw+8/1G+jVM8c5deaHKNxK8usZNZYMe6S56I=' 
WHERE 
  key_id = '0e12c8ff53975c2208353a304568e3b6e97967ab15374c167c7b5b3594d70800' 
  AND (
    token = 'tD81rRFrw+8/1G+jVM8c5deaHKNxK8usZNZYMe6S56I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033