UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M8UTBucXIM/Zr7yJuyDp0qC+q+5Sq/ypR9dh1I/fTkk=' 
WHERE 
  key_id = '6c8951bf2baf0c482ea514121572e62bf968d7969c403517a9ee434df3c202b7' 
  AND (
    token = 'M8UTBucXIM/Zr7yJuyDp0qC+q+5Sq/ypR9dh1I/fTkk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052