UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ynX5sxdP+QTqjDDRJWBcrvRp2ytvlRQduakxW6FLkTM=' 
WHERE 
  key_id = 'f9366bf58590ea82f0d04c7214f29040ccf825f4bf90a3d49d4d026cfb9ef7c1' 
  AND (
    token = 'ynX5sxdP+QTqjDDRJWBcrvRp2ytvlRQduakxW6FLkTM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037