UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1ONqkD3BTDTL20LrDi4YExfTc64PM4i8MrcuGST/P24=' 
WHERE 
  key_id = '04a215eff2089a2c8472e711d301effcdf17b0685abe4a751d5b234e82947908' 
  AND (
    token = '1ONqkD3BTDTL20LrDi4YExfTc64PM4i8MrcuGST/P24=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00071