UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SAUsAWVEpTkQBXnlBBYp6x3Z3DX5tmFQVNz6sqg7EBs=' 
WHERE 
  key_id = '16dcd9945d85c0eb8468c8128b6ac98ba48459a423efa452c356e8622bc1e797' 
  AND (
    token = 'SAUsAWVEpTkQBXnlBBYp6x3Z3DX5tmFQVNz6sqg7EBs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046