UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ayssM/aCNUmj0BGPHaNWVLe+KhZKtprQ6viB/HPHOBA=' 
WHERE 
  key_id = 'cf43251a32cf2be35764ca2edc33e5a12e583d4d79590d3f18c580d9435b0ddb' 
  AND (
    token = 'ayssM/aCNUmj0BGPHaNWVLe+KhZKtprQ6viB/HPHOBA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023