UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UoIQQHTz0x0RpT1miVSn6P+3IF11dE4n/q0q0dmis2g=' 
WHERE 
  key_id = 'a36de883788484a0ad052746df0c207271731b3ab7dc65b43a93139b8844c5b9' 
  AND (
    token = 'UoIQQHTz0x0RpT1miVSn6P+3IF11dE4n/q0q0dmis2g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035