UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IM8IP+H/LNopjrv6uu/NK+VXJjLWl+JQXL+X4FC5rKI=' 
WHERE 
  key_id = '5c4d47149b6549a08d67a90d912ddb5183ebe4d3418c5e50659d202c40694dfd' 
  AND (
    token = 'IM8IP+H/LNopjrv6uu/NK+VXJjLWl+JQXL+X4FC5rKI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048