UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q31LvxMWZrFp5FfOMX+Fk+0hNDg9G+sCQj+Ph2YyU+w=' 
WHERE 
  key_id = '7256f0bf1f751b72d239d874d474848a42b4d277c65fb6055b6dd4305cec1dc5' 
  AND (
    token = 'Q31LvxMWZrFp5FfOMX+Fk+0hNDg9G+sCQj+Ph2YyU+w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024