UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i1s4GSzwqE76778AghONpNFMMLI9/XvYXGeOdTcxkxI=' 
WHERE 
  key_id = 'dc941b34bada443a4d9f9d5b168b7b0f287e0e04f283a2c1d062b9ceb2004cd6' 
  AND (
    token = 'i1s4GSzwqE76778AghONpNFMMLI9/XvYXGeOdTcxkxI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020