UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xe1V/BbZ60lsxmS0earWsJ7aXAN8sfpMZtpYOktD7nc=' 
WHERE 
  key_id = '20c2dd99238b262df46f57976f6eb4481304331963be3e9c28b682512f446318' 
  AND (
    token = 'xe1V/BbZ60lsxmS0earWsJ7aXAN8sfpMZtpYOktD7nc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038