UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rfbcObK0fHQCS2GPWafJjfF5vmSq3UUuTeZnH2wskkU=' 
WHERE 
  key_id = '820d5080cde70fbb70b3b67355b30fd1d7be36100bc08f83989ee6924c5c59bc' 
  AND (
    token = 'rfbcObK0fHQCS2GPWafJjfF5vmSq3UUuTeZnH2wskkU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034