UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nTnNM4rnTu51E2RAJLndDTVYSW7JUTxb50GN9frglVE=' 
WHERE 
  key_id = '0bf38e05efc825fee681994f7c0027384ad1c32db4ce9fa946c12e00281d4f78' 
  AND (
    token = 'nTnNM4rnTu51E2RAJLndDTVYSW7JUTxb50GN9frglVE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025