UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XNBsJHXuT2Or+/1GRYCe4B3tWECawhCOGh1LaKCdyck=' 
WHERE 
  key_id = '9ef81d0ec79c7b8dae54cdb97c194a2f21a2e7759ca6fa37061910e94aabc59b' 
  AND (
    token = 'XNBsJHXuT2Or+/1GRYCe4B3tWECawhCOGh1LaKCdyck=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034