UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xSrFiDjsfI5EddFnwFMthWtFVstcUAEWrff8AhYQZOo=' 
WHERE 
  key_id = '456a72d1838f2e16a1d3aa0af8fdfd38b1dd0b99c7abd4da96e381087d3c9cc7' 
  AND (
    token = 'xSrFiDjsfI5EddFnwFMthWtFVstcUAEWrff8AhYQZOo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048