UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ypHlWInALuyRrU2weXGmyXq+nrSeIEpJeTGi/4cFkws=' 
WHERE 
  key_id = '683235e696c41f4f536c85f7d066f8d57b9a748784cd2fa60623bd66f3324f9d' 
  AND (
    token = 'ypHlWInALuyRrU2weXGmyXq+nrSeIEpJeTGi/4cFkws=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015