UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n2jU7I8JMhvH72mTDsrdApXsGlVf1ef9laGDMF5zado=' 
WHERE 
  key_id = '3ebcfd69fd356dedb7e24f7ebce3b941404c3042300fa99e02faabdcd31bf050' 
  AND (
    token = 'n2jU7I8JMhvH72mTDsrdApXsGlVf1ef9laGDMF5zado=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044