UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+rNelYJEp3CqLyl6aYJnipPnKPw3VsieALck7cBFOzQ=' 
WHERE 
  key_id = '64246d1474386c96d942adec1e835902628e69ff5d69f52c93474e49fc91b39d' 
  AND (
    token = '+rNelYJEp3CqLyl6aYJnipPnKPw3VsieALck7cBFOzQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041