UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ShJ3k5dF2oRKOOHrTxNPxTnjc+C3I6Le222FX+Zt5tU=' 
WHERE 
  key_id = '76196517e54be7ff9f8316dbe67ceb0dd645b9c23860d61e3186e76280580e02' 
  AND (
    token = 'ShJ3k5dF2oRKOOHrTxNPxTnjc+C3I6Le222FX+Zt5tU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048