UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SpqgKOZr4muCWB06ZexbTW4z6gar2rERz+cFJalLNTc=' 
WHERE 
  key_id = '78dc3855b40e14722a1bed40e6b630252752da3d139af55fcf21db7f2bbb6245' 
  AND (
    token = 'SpqgKOZr4muCWB06ZexbTW4z6gar2rERz+cFJalLNTc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035